
using System.Collections;

namespace PVTLibrary
{
    public class Common
    {


        Shared Function Min(ByVal Vv As Array, ByVal Vz As Array)

            Dim n = UBound(Vv)
            Dim mx As Double

            If n >= 1 Then
                Dim i As Integer = 1

                'Do
                '    mx = Vv(i - 1)
                '    i += 1
                'Loop Until i = n + 1

                mx = Vv(i - 1)
                i = 0
                Do
                    If Vv(i) < mx And Vz(i) <> 0 Then
                        mx = Vv(i)
                    End If
                    i += 1
                Loop Until i = n + 1

                Return mx
            Else
                If Vv.Length > 0 Then Return Vv(0) Else Return 0
            End If

        End Function

        Shared Function Min(ByVal Vv As Array)

            Dim n = UBound(Vv)
            Dim mx As Double

            If n >= 1 Then
                Dim i As Integer = 1

                Do
                    If Vv(i - 1) <> 0 Then
                        mx = Vv(i - 1)
                        Exit Do
                    End If
                    i += 1
                Loop Until i = n + 2

                i = i - 1
                Do
                    If Vv(i) < mx Then
                        mx = Vv(i)
                    End If
                    i += 1
                Loop Until i = n + 1

                Return mx
            Else
                If Vv.Length > 0 Then Return Vv(0) Else Return 0
            End If

        End Function







}
}